package com.erp.order.controller;

import com.erp.order.domain.bo.ErpHandoverOrdersInfoSelBo;
import com.erp.order.domain.vo.ErpHandoverOrdersInfoSelVo;
import com.erp.order.service.IAeHandoverOrdersService;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.oldController.BaseController;
import com.ruoyi.common.core.web.oldPage.TableDataInfo;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RequiredArgsConstructor

/**
 * 组包店铺
 */
@RestController
@RequestMapping("/ae/handoverOrders")
public class AeHandoverOrdersController extends BaseController {

    private final IAeHandoverOrdersService iAeHandoverOrdersService;

    /**
     * 新版 跨店铺菜鸟组包接口
     */
    @GetMapping("/handoverCommit")
    public R<Object> handoverCommit(@Param("orderIds") String orderIds) {
        return iAeHandoverOrdersService.handoverCommit(orderIds);
    }

    /**
     * 自动组包
     */
    @GetMapping("/handoverCommitAuto")
    public R<Object> handoverCommitAuto() {
        return iAeHandoverOrdersService.handoverCommitAuto();
    }

    /**
     * 查看已组包的订单
     */
    @GetMapping("/selectHandoverOrderList")
    public TableDataInfo<ErpHandoverOrdersInfoSelVo> selectHandoverOrderList(ErpHandoverOrdersInfoSelBo bo, PageQuery pageQuery) {
        return iAeHandoverOrdersService.selectHandoverOrderList(pageQuery, bo);
    }

    /**
     * 查看已组包的订单小包列表
     */
    @GetMapping("/selectHandoverOrderDetails")
    public R<Object> selectHandoverOrderDetails(Long handoverOrderId) {
        return iAeHandoverOrdersService.selectHandoverOrderDetails(handoverOrderId);
    }

    /**
     * 新版 更新获取交接单信息
     */
    @GetMapping("/updateHandoverOrderNew")
    public void updateHandoverOrderNew() {
        iAeHandoverOrdersService.updateHandoverOrderNew();
    }

    /**
     * 新版 更新获取交接单面单
     * @param handoverOrderId
     * @return
     */
    @GetMapping("/getOrderExpressSheet")
    public R<Object> getOrderExpressSheet(@Param("handoverOrderId") Long handoverOrderId) {
        return iAeHandoverOrdersService.getOrderExpressSheet(handoverOrderId);
    }
}
